<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">
<h:head>
	<title>Search example</title>
</h:head>
<h:body>
	<h:form id="mainForm">
		<h:panelGrid columns="4" id="selectGrid">
			<h:outputText value="Id" />
			<h:inputText value="#{searchJSFBean.userFilter.id}"></h:inputText>

			<h:outputText value="Név" />
			<h:inputText value="#{searchJSFBean.userFilter.name}"></h:inputText>

			<h:outputText value="Foglalkozás" />
			<h:inputText value="#{searchJSFBean.userFilter.profession}"></h:inputText>

			<h:outputText value="Anyja neve" />
			<h:inputText value="#{searchJSFBean.userFilter.motherName}"></h:inputText>

			<h:outputText value="Kutya azonosítója" />
			<h:inputText value="#{searchJSFBean.dogId}"></h:inputText>

		</h:panelGrid>
		<h:commandButton value="Gazda keresés">
			<f:ajax event="click" execute="selectGrid"
				listener="#{searchJSFBean.doSearchUser}" render="searchResultUsers searchResultCats"></f:ajax>
		</h:commandButton>
		<h:commandButton value="Gazda macskái (a userId kitöltése kell hozzá)">
			<f:ajax event="click" execute="selectGrid"
				listener="#{searchJSFBean.doSearchCatsofOwner}" render="searchResultUsers searchResultCats"></f:ajax>
		</h:commandButton>
		<h:commandButton
			value="Adott kutya által megkergetett macskák (a kutyaId kitöltése kell hozzá)">
			<f:ajax event="click" execute="selectGrid"
				listener="#{searchJSFBean.doSearchCatsofOwner}" render="searchResultUsers searchResultCats"></f:ajax>
		</h:commandButton>
		<br />
		<h:panelGroup id="searchResultUsers">
		<h:dataTable  value="#{searchJSFBean.searchResultUsers}" var="user" rendered="#{not empty searchJSFBean.searchResultUsers}">
			<h:column>
				<h:outputText value="#{user.id}"></h:outputText>
			</h:column>
			<h:column>
				<h:outputText value="#{user.name}"></h:outputText>
			</h:column>
			<h:column>
				<h:outputText value="#{user.motherName}"></h:outputText>
			</h:column>
		</h:dataTable>
		</h:panelGroup>
		
		<h:panelGroup id="searchResultCats">
		<h:dataTable  value="#{searchJSFBean.searchResulCats}" var="cat" rendered="#{not empty searchJSFBean.searchResulCats}">
			<h:column>
				<h:outputText value="#{cat.id}"></h:outputText>
			</h:column>
			<h:column>
				<h:outputText value="#{cat.name}"></h:outputText>
			</h:column>
		</h:dataTable>
		</h:panelGroup>
		
	</h:form>
</h:body>
</html>
